//
//  Message.m
//  fupengdouban
//
//  Created by lanou3g on 15/10/23.
//  Copyright © 2015年 fuoeng. All rights reserved.
//

#import "Message.h"
#import "DownLoad.h"

@implementation Message

//-(void)setValue:(id)value forKey:(NSString *)key{
//    if ([key isEqualToString:@"owner"]) {
//        self.name = value[@"name"];
//    }
//}

- (void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    
    if ([key isEqualToString:@"id"]) {
        
        self.a_id = value;
    }
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
    if ([key isEqualToString:@"owner"]) {
        self.name = value[@"name"];
    }
    
    
}


-(void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.title forKey:@"title"];
    [aCoder encodeObject:self.begin_time forKey:@"begin_time"];
    [aCoder encodeObject:self.end_time forKey:@"end_time"];
    [aCoder encodeObject:self.address forKey:@"address"];
    [aCoder encodeObject:self.category_name forKey:@"category_name"];
    [aCoder encodeObject:self.image forKey:@"image"];
    [aCoder encodeObject:self.content forKey:@"content"];
    [aCoder encodeObject:self.wisher_count forKey:@"wisher_count"];
    [aCoder encodeObject:self.participant_count forKey:@"participant_count"];
    [aCoder encodeBool:self.isFavorite forKey:@"isFavorite"];
    [aCoder encodeObject:self.name forKey:@"name"];
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.title = [aDecoder decodeObjectForKey:@"title"];
        self.begin_time = [aDecoder decodeObjectForKey:@"begin_time"];
        self.end_time = [aDecoder decodeObjectForKey:@"end_time"];
        self.address = [aDecoder decodeObjectForKey:@"address"];
        self.category_name = [aDecoder decodeObjectForKey:@"category_name"];
        self.image = [aDecoder decodeObjectForKey:@"image"];
        self.content = [aDecoder decodeObjectForKey:@"content"];
        self.wisher_count = [aDecoder decodeObjectForKey:@"wisher_count"];
        self.participant_count = [aDecoder decodeObjectForKey:@"participant_count"];
        self.isFavorite = [aDecoder decodeBoolForKey:@"isFavorite"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
    }
    return self;

}



@end
